In a computer system, virtual memory management automates the movement of instructions and data between physical memory and secondary storage giving the appearance of a single, large memory. Conceptually, the address space of a processor is divided into virtual memory pages of a uniform size, and the physical memory is divided into physical memory pages of the same size. The operating system (OS) and the memory management hardware (i.e., memory management unit (MMU)) of the processor map virtual memory pages into and out of the physical memory pages as applications are executed on the processor. The OS and MMU translate system virtual addresses from the processor into physical memory addresses behind the scenes, creating the illusion of a single-level store with faster access time of random-access memory rather than that of secondary storage.
The concept of the MMU (i.e., to translate system virtual addresses to physical memory addresses) has been extended to work with remote devices and peripheral devices connected to the computer system via an Input/Output (I/O) bus. One such extension is an I/O MMU that performs the same functions as the MMU, but rather than receiving system virtual addresses from the processor, the I/O MMU receives I/O virtual addresses from peripheral devices (or remote devices) via a direct virtual memory access (DVMA) engine. DVMA engines are used to support direct memory access (DMA), which is widely used to move data between the computer system's physical memory and I/O devices. A DMA write request allows the copying of data directly into the computer system's physical memory. Further, a DMA read request allows the reading of data directly from the computer system's physical memory.
As noted above, the I/O MMU enables remote devices and peripheral devices to access the computer system's physical memory by translating the I/O virtual addresses provided by the DVMA engine (i.e., read and write requests) into physical addresses. The physical address may then be used to access the computer system's physical memory and perform the request. More specifically, when a peripheral device (or remote device) requests to access a particular portion of the computer system's physical memory, a request is made to the operating system (or a subsystem therein) to setup a virtual-to-physical address mapping and associated data structures (i.e., data structures required to process the DMA request). The virtual-to-physical mapping is then used to populate an entry in a mapping table located in the I/O MMU. Once the mapping and associated data structures have been setup and the mapping table populated, control is transferred to the DVMA engine. The DVMA engine proceeds to obtain an I/O virtual address from the peripheral device (or remote device) and places the I/O virtual address on the computer system's I/O bus. The I/O MMU, which monitors the I/O bus, obtains the I/O virtual address and proceeds to look up the corresponding physical address in the mapping table.
The I/O MMU subsequently places the corresponding physical address on the I/O bus. The DVMA engine retrieves the physical address and proceeds to read or write data to/from the physical memory using the physical address. Once the DVMA engine has completed the transfer/retrieval of data, the operating system (or a subsystem therein) proceeds to deconstruct the associated data structures and removes the virtual-to-physical mapping entry from the mapping table in the I/O MMU. This process is subsequently repeated for each DMA request.